#include "common.h"
struct v2p {
float2 tc0:TEXCOORD0;
float4 tc1:TEXCOORD1;
float4 tc2:TEXCOORD2;
float4 tc3:TEXCOORD3;
float4 tc4:TEXCOORD4;
float4 tc5:TEXCOORD5;
float4 tc6:TEXCOORD6;
float4 tc7:TEXCOORD7;
};
uniform half4 e_kernel;
uniform half4 weight[2];
half4 main(v2p I):COLOR {

float x = e_kernel.x;
float o[15];
o[0] = 1;
o[1] = 2;
o[2] = 3;
o[3] = 4;
o[4] = 5;
o[5] = 4;
o[6] = 3;
o[7] = 2;
o[8] = 1;
o[9] = 1;
o[10] = 2;
o[11] = 3;
o[12] = 4;
o[13] = 3;
o[14] = 2;

/*
int factor = 400;
o[0] = (x == 0.4) ? factor : 1;
o[1] = (x == 0.41) ? factor : 1;
o[2] = (x == 0.42) ? factor : 1;
o[3] = (x == 0.43) ? factor : 1;
o[4] = (x == 0.44) ? factor : 1;
o[5] = (x == 0.45) ? factor : 1;
o[6] = (x == 0.46) ? factor : 1;
o[7] = (x == 0.47) ? factor : 1;
o[8] = (x == 0.48) ? factor : 1;
o[9] = (x == 0.49) ? factor : 1;
o[10] = (x == 0.5) ? factor : 1;
o[11] = (x == 0.51) ? factor : 1;
o[12] = (x == 0.52) ? factor : 1;
o[13] = (x == 0.53) ? factor : 1;
o[14] = (x > 0.53) ? factor : 1;
*/
half4 accum=weight[1].w*tex2D(s_bloom,I.tc0) * o[0];
accum+=weight[0].x*tex2D(s_bloom,I.tc1.xy) * o[1];
accum+=weight[0].x*tex2D(s_bloom,I.tc1.wz) * o[2];
accum+=weight[0].y*tex2D(s_bloom,I.tc2.xy) * o[3];
accum+=weight[0].y*tex2D(s_bloom,I.tc2.wz) * o[4];
accum+=weight[0].z*tex2D(s_bloom,I.tc3.xy) * o[5];
accum+=weight[0].z*tex2D(s_bloom,I.tc3.wz) * o[6];
accum+=weight[0].w*tex2D(s_bloom,I.tc4.xy) * o[7];
accum+=weight[0].w*tex2D(s_bloom,I.tc4.wz) * o[8];
accum+=weight[1].x*tex2D(s_bloom,I.tc5.xy) * o[9];
accum+=weight[1].x*tex2D(s_bloom,I.tc5.wz) * o[10];
accum+=weight[1].y*tex2D(s_bloom,I.tc6.xy) * o[11];
accum+=weight[1].y*tex2D(s_bloom,I.tc6.wz) * o[12];
accum+=weight[1].z*tex2D(s_bloom,I.tc7.xy) * o[13];
accum+=weight[1].z*tex2D(s_bloom,I.tc7.wz) * o[14];
return accum;

//return half4(0, 0, 0, 0);
}